local skel = fk.CreateSkill {
  name = "emo__huanshou",
}

Fk:loadTranslationTable{
  ["emo__huanshou"] = "幻兽",
  [":emo__huanshou"] = "你可以失去一个技能视为使用【杀】/【闪】，并弃置目标角色/响应角色一张牌。",

  ["#emo__huanshou-prompt"] = "幻兽：你可以失去一个技能视为使用【杀】/【闪】",
  ["#emo__huanshou-delete"] = "幻兽：选择要失去的技能",
}

skel:addEffect("viewas", {
  anim_type = "control",
  pattern = "slash,jink",
  prompt = "#emo__huanshou-prompt",
  interaction = function (self, player)
    local all_choices = {"slash", "jink"}
    local names = player:getViewAsCardNames(self.name, all_choices)
    if #names == 0 then return end
    return UI.CardNameBox {choices = names, all_choices = all_choices}
  end,
  card_filter = Util.FalseFunc,
  before_use = function (self, player, use)
    local room = player.room
    local skills = player:getSkillNameList()
    if #skills == 0 then return "" end
    local skill = room:askToChoice(player, { choices = skills, skill_name = self.name,
    prompt = "#emo__huanshou-delete", detailed = #skills < 4 })
    room:handleAddLoseSkills(player, "-"..skill)
  end,
  after_use = function(self, player, use)
    local room = player.room
    local tos = {}
    if use.card.trueName == "slash" and use.tos then
      tos = use.tos
    elseif use.responseToEvent and use.responseToEvent.from then
      tos = {use.responseToEvent.from}
    end
    for _, to in ipairs(tos) do
      if player.dead then break end
      if not to:isNude() then
        local card = room:askToChooseCard(player, { target = to, flag = "he", skill_name = self.name})
        room:throwCard(card, self.name, to, player)
      end
    end
  end,
  view_as = function (self)
    if Fk.all_card_types[self.interaction.data] == nil then return end
    local card = Fk:cloneCard(self.interaction.data)
    card.skillName = self.name
    return card
  end,
  enabled_at_play = function(self, player)
    return #player:getSkillNameList() > 0
  end,
  enabled_at_response = function (self, player, response)
    return not response and #player:getSkillNameList() > 0
  end,
})

return skel
